#ifndef _param_c
#define _param_C

typedef struct paramList
{
	char lb_lp_sp_current;
	char lb_lp_hs_current;
	char hb_lp_sp_current;
	char hb_lp_hs_current;
	char lb_hp_sp_current;
	char lb_hp_hs_current;
	char hb_hp_sp_current;
	char hb_hp_hs_current;
	char temp_limit;
	char temp_ramp;
	
	char checksum;
} paramList_T;
	
const paramList_T defaultParam =
{ 50, 50, 50, 50, 50, 50, 50, 50, 85, 10 };	
	
paramList_T param;

#define MAIN_PARAM_CHKSUM_ADDR	0
#define MAIN_PARAM_LIST_ADDR		1

#define MAIN_PARAM_LIST		0
#define BACK_PARAM_LIST		( MAIN_PARAM_LIST + sizeof(paramList) )
	
void loadParams( void )
{
	char i = 0;
	char chksum = 0;
	char *p, *c;
	p = &param;
	
	ee_read( MAIN_PARAM_LIST, &param, sizeof(paramList) );
	while( i<sizeof(param) )
		chksum += *p++;
		
	p = &param;
	if( *p == 0 )
		restoreParams( &defaultParam );
		
	if( chksum )
		restoreParams( &defaultParam );
		
}	

void restoreParamsFromDefault( void )
{
	char i=0;
	char *src;
	char *dst;
	src = &defaultParam;
	dst = &param;
	while( i<sizeof(param) )
		*dst++ = *src++;
}

// Restore Parameter Block
//		Reads either the default or backup parameter block
// Inputs:
//		char *src:	Source pointer
// Returns:
//		void
void restoreParams( char *src )
{
	char i=0;
	char *dst;
	dst = &param;
	while( i<sizeof(param) )
		*dst++ = *src++;
}



#define P_LB_LP_SP_CURRENT_ADDR	0
#define P_LB_LP_HS_CURRENT_ADDR	1
#define P_HB_LP_CURRENT_ADDR		2
#define P_LB_HP_CURRENT_ADDR		3
#define P_HB_HP_CURRENT_ADDR		4

#endif
